<?php

namespace IDock\Insurance\ZSIC\Request;

use Exception;
use IDock\Insurance\ZSIC\Response\UnderwritingRecall2Response;
use IDock\Visitor\ProposalRecallVisitor;

class UnderwritingRecall2Request extends AllZSICRequest
{
    public $requestCode = 'cancelProposal';

    protected $response = UnderwritingRecall2Response::class;

    protected $urlTip = '核保撤回';

    /**
     * @var ProposalRecallVisitor $visitor
     */
    protected $visitor;

    /**
     * @return array
     * @throws Exception
     */
    public function generate(): array
    {
        $this->channelCode = $this->visitor->argc['channelCode'] ?? '';
        $this->cityCode = $this->visitor->argc['cityCode'] ?? '';

        $param = [
            'base' => [
                'orderNo' => $this->visitor->argc['orderNo'] ?? '',
                'quotationNo' => $this->visitor->argc['quotationNo'] ?? '',
                'vciProposalNo' => $this->visitor->argc['vciProposalNo'] ?? '',
                'tciProposalNo' => $this->visitor->argc['tciProposalNo'] ?? '',
            ],
            'nonVehicleProducts' => [
                'proposalNo' => $this->visitor->argc['nonCarProposalNo'] ?? '',
            ]
        ];

        return $param;
    }

    public function getBusinessNo()
    {
        return $this->visitor->argc['businessNo'] ?? '';
    }
}
